Skip to content

Update xunit templates to xunit.v3 #50117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Aug 7, 2025

Description

We would like to update templates for xUnit.net version 2, to version 3, because it is the current version of xUnit.net. We want to make this change now, and keep pushing newer versions of xunit 3 into the templates until the release of .NET. The update between v3 and v2 has potential to break users, which is why we want to do it now rather than later. The subsequent updates will be bug fixes.

Customer Impact

Users creating new test projects for xunit.net will use xunit.net v3, while previously they would use v2. Users are able to change the versions back to xunit v2 if they wish to stay on v2. Or they can migrate their other projects to v3 using this migration guide: https://xunit.net/docs/getting###started/v3/migration

Regression

No.

Risk

Low.
Users are able to easily revert their dependency versions to target xunit.net v2. Xunit.net v2 is not under active development as is rarely receiving new fixes, which is why we want to prefer v3.

Link the PR to the original issue and to the PR to main.

#50117

Note any packaging impact

No impact.

Note any ref pack impact.

No impact.

Fixes #45645

@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 17:55
@Youssef1313 Youssef1313 requested a review from a team as a code owner August 7, 2025 17:55
@Youssef1313 Youssef1313 requested a review from baronfel August 7, 2025 17:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the xUnit templates to use xUnit v3 by replacing the xunit package references with xunit.v3 across all project templates and adding Microsoft.Testing.Platform configuration guidance.

Key Changes

  • Updated package references from xunit version 2.9.3 to xunit.v3 version 3.0.0
  • Added commented configuration options and documentation for Microsoft.Testing.Platform integration
  • Applied changes consistently across C#, F#, and Visual Basic project templates

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Company.TestProject1.csproj Updated C# xUnit template with v3 package and Microsoft.Testing.Platform documentation
Company.TestProject1.fsproj Updated F# xUnit template with v3 package and Microsoft.Testing.Platform documentation
Company.TestProject1.vbproj Updated VB xUnit template with v3 package and Microsoft.Testing.Platform documentation

@Youssef1313 Youssef1313 mentioned this pull request Aug 7, 2025
@bradwilson
Copy link
Contributor

Is there any reason these templates shouldn't be exactly what we're shipping in xunit.v3.templates?

@bradwilson
Copy link
Contributor

What I'm saying here is: I like my templates a lot better than yours. Shipping them was not just a holdover waiting for you to update yours.

@Youssef1313
Copy link
Member Author

Youssef1313 commented Aug 7, 2025

@bradwilson Is it better now? Any other concerns you have with the current shape? Maybe we could add xunit.runner.json similar to your templates. Anything other than that?

@bradwilson
Copy link
Contributor

I would love for you to include a default xunit.runner.json like we do. That's a pretty big usability win for us because we include the schema in the JSON file which gives them intellisense in all the major IDEs.

@Youssef1313
Copy link
Member Author

I agree!

@bradwilson
Copy link
Contributor

We also ship templates for extension authors, but I'm guessing that's probably beyond scope for inclusion here (which means we'll still end up shipping our templates; that'll need to be true until net8 is out of support anyways, since these new templates are only going in the net10 SDK).

@bradwilson
Copy link
Contributor

For the xunit.runner.json file, just this is enough:

{
    "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json"
}

Along with this in the project file:

  <ItemGroup>
    <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup

It's applicable to all languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xunit template
3 participants